import React, {Component} from 'react';
import {
    StyleSheet,
    Text,
    View,
    Image,
    ToastAndroid,
    TouchableOpacity,
} from 'react-native';
import HomeMunuItemView from "./HomeMunuItemView";
/**
 * 由 WangYu 创建
 * 日期 2017/9/13
 */
export default class HomeMiddleView extends Component {

    constructor(props) {
        super(props);
    }

    render() {
        let dataLeft=this.props.data.dataLeft[0];
        let dataRight=this.props.data.dataRight;//这是一个数组
        return (
            <View style={styles.middleLayoutStyle}>
                <TouchableOpacity style={{flex:1}}>
                <View style={{flex:1,justifyContent:'center',alignItems:'center'}}>
                    <Image source={{uri:dataLeft.img1}}  style={{width:120,height:30}}/>
                    <Image source={{uri:dataLeft.img2}} resizeMode={'cover'} style={{width:120,height:30,marginTop:5}}/>
                    <Text style={{fontSize:16,color:'#666666'}}>{dataLeft.title}</Text>
                    <View style={{flexDirection:'row'}}>
                        <Text style={{color:'green'}}>{dataLeft.price}</Text>
                        <Text style={{color:'red',backgroundColor:'yellow',fontWeight:'bold',marginLeft:10}}>{dataLeft.sale}</Text>
                    </View>
                </View></TouchableOpacity>
                <View style={{flex:1,borderLeftWidth:1,borderLeftColor:'#cccccc'}}>
                    <HomeMunuItemView
                        titleColor={dataRight[0].titleColor}
                        title={dataRight[0].title}
                        subTitle={dataRight[0].subTitle}
                        imageUri={dataRight[0].rightImage}/>
                    <View style={{height:1,backgroundColor:'#cccccc'}}/>
                    <HomeMunuItemView
                        titleColor={dataRight[1].titleColor}
                        title={dataRight[1].title}
                        subTitle={dataRight[1].subTitle}
                        imageUri={dataRight[1].rightImage}/>
                </View>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
    },
    middleLayoutStyle:{
        backgroundColor:'white',
        height:120,
        flexDirection:'row',
    }
});
